﻿#ifndef _VIDEO_
#define _VIDEO_

#include <Windows.h>

#include "./sdl/include/SDL.h"
#include "./sdl/include/SDL_syswm.h"
#include "sdlyuvaddon.h"

#include "stream.h"


class CVideo
{
public :
	CVideo();
	~CVideo();

	bool	InitVideo(int w, int h);
	bool	InitOverlay(int width, int height, int format );

	void	Render(int x, int y, SDL_Surface *surface);
	void	Present();
	HWND	GetWindowHandle() { return m_hwnd; }

	POINT	GetCursorPos() { return m_cursorpos; }
	RECT	GetWindowRect() { return m_rect; }
	void	SetCursorPos(POINT pos) { m_cursorpos = pos; }
	void	SetWindowRect(RECT rect) { m_rect = rect; }

	void	RenderOverlay( int width, int height );
	void	LockOverlay();
	void	UnLockOverlay();

	SDL_Overlay *	GetOverlay() { return m_overlay; }

public :
	int		m_window_posx;
	int		m_window_posy;

	int		m_video_width;
	int		m_video_height;
private :

	int		m_video_bpp;

	POINT	m_cursorpos;
	RECT	m_rect;

	SDL_Surface *	m_screen;
	HWND			m_hwnd;

	SDL_Overlay *		m_overlay;
	SDL_YUVSurface *	m_yuv;
	SDL_Surface *		m_rgb;
};

#endif